/*
 * ======== Standard MSP430 includes ========
 */
#include <msp430.h>

/*
 * ======== Grace related includes ========
 */
#include <ti/mcu/msp430/csl/CSL.h>
void ir_TX(char data);
void init(void);
/*
 *  ======== main ========
 */
int main(int argc, char *argv[])
{
	init();
    CSL_init();                     // Activate Grace-generated configuration
    char data;
    ir_TX(data);
    
    return (0);
}

void init(void)
{
	 WDTCTL = WDTPW + WDTHOLD;  // Stop WDT

	 P1DIR |= BIT2;             // P1.2 to output
	 P1SEL |= BIT2;             // P1.2 to TA0.1
	 TACTL = TASSEL_2 + MC_1;   // SMCLK, up mode
}
void ir_TX(char data)
{
	// high then low bits for starting signal
	pwm_Active();
	pwm_Low();
	// transmit actual data packet
	unsigned char mask = 0b10000000;
	for(i = 0; i < 8; i ++)
	{
		if((data & mask) == mask)
			//TimerA_UART_tx('1');
			pwm_Active();
		else
			//TimerA_UART_tx('0');
			pwm_LOW();
		mask = mask >> 0x01;	// shift mask over
	}
	pwm_Active();	// active PWM for Even parity
}

pwm_Active()
{
	set pwm to active;
	timer; // 3.3 ms
}
pwm_Low()
{
	set low;
	timer;	// 3.3 ms
}
